package action;

import character.Character;
import game.CombatController;
import game.CombatUtil;

public class AttackAction extends Action {
    protected Character target;
    
    @Deprecated
    public AttackAction() {}
    
    public AttackAction(Character attacker, Character target) {
        super(attacker, attacker.getInventory().getEquippedWeapon().getBaseSpeed());
        this.target = target;
    }

    @Override
    protected void start() {
        System.out.println(character+" swings its arm back...");
    }

    @Override
    protected void complete() {
        CombatController.attack(character, target);
    }

    @Override
    protected void tick() {
        if(!CombatUtil.checkAttackRange(character, target)) {
            System.out.println("Target moved out of range.");
            character.getActionQueue().dequeueAction(this);
        }
    }

    @Override
    public void pause() {}

    @Override
    public void unpause() {}
    
}
